package com.oa.config;

import com.jagregory.shiro.freemarker.ShiroTags;
import com.oa.common.handler.SpringApplicationHolder;
import com.oa.common.utils.RequestUtil;
import com.oa.service.CommonService;
import org.springframework.web.servlet.view.freemarker.FreeMarkerView;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public class MyFreemarkerView extends FreeMarkerView {

    @Override
    protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request) throws Exception {
        String base = RequestUtil.getBasePath(request);
        CommonService commonService= SpringApplicationHolder.getBean(CommonService.class);
        String token = commonService.getToken(request);
        model.put("base", base);
        model.put("token",token);

        super.exposeHelpers(model, request);
    }
}
